<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="StyleSheet.jsc Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="../index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="../overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="../allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>StyleSheet.jsc</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		js.dom.StyleSheet class http://jsvm.homolo.com/jsvm2.0/docs/api/
 <BR/><BR/><B>Version: </B>2.01, 10/23/05
 <BR/><BR/><B>Author:</B> Wan Changhua
 <BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="StyleSheet.html">js.dom.StyleSheet</a></b></td>
    <td>This is the StyleSheet class.</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"># language: JSVM2

<span class="comment">/**
 * <span class="attrib">@fileoverview</span> js.dom.StyleSheet class http://jsvm.homolo.com/jsvm2.0/docs/api/
 * <span class="attrib">@file</span>		StyleSheet.jsc
 * <span class="attrib">@author</span>	Wan Changhua
 * <span class="attrib">@version</span>	2.01, 10/23/05
 * <span class="attrib">@since</span>		JSVM2.0
 */</span>

package js.dom;

import js.lang.System;
import js.lang.BObject;

<span class="comment">/**
 * Create a new js.dom.StyleSheet instance.
 * Inherit from BObject
 * <span class="attrib">@author</span>	Wan Changhua
 * <span class="attrib">@version</span>	2.01, 10/23/05
 * <span class="attrib">@extends</span> BObject
 * <span class="attrib">@class</span> This is the StyleSheet class.  
 * <span class="attrib">@constructor</span>
 * <span class="attrib">@param</span> &lt;Object&gt; cs
 * <span class="attrib">@return</span> A new StyleSheet object
 */</span>

<span class="reserved">function</span> StyleSheet (cs)
{
	<span class="comment">/**
	 * <span class="attrib">@private</span>
	 */</span>
	<span class="reserved">this</span>.styleSheet = cs;
}

<span class="comment">/**
 * Creates a new style rule for the styleSheet object, 
 * and returns the index into the rules collection.
 * <span class="attrib">@param</span> &lt;String&gt; sSelector that specifies the selector for the new rule.
 *				Single contextual selectors are valid
 * <span class="attrib">@param</span> &lt;String&gt; sStyle that specifies the style assignments for this style rule. 
 *				This style takes the same form as an inline style specification. 
 *				For example, "color:blue" is a valid style parameter.
 * <span class="attrib">@param</span> &lt;int&gt; iIndex Integer that specifies the location in the rules collection to add the new style rule. 
 *				If an index is not provided, the rule is added to the end of the collection by default.
 */</span>
StyleSheet.<span class="reserved">prototype</span>.addRule = <span class="reserved">function</span> (sSelector, sStyle , iIndex)
{
	<span class="reserved">if</span> (iIndex == null)
	{
		iIndex = (js.lang.System.isIeBrowser()) ? <span class="reserved">this</span>.styleSheet.rules.length
			: <span class="reserved">this</span>.styleSheet.cssRules.length;
	}
	<span class="reserved">if</span> (js.lang.System.isIeBrowser())
	{
		<span class="reserved">this</span>.styleSheet.addRule(sSelector, sStyle , iIndex);
	}
	<span class="reserved">if</span> (js.lang.System.isMozBrowser())
	{
		<span class="reserved">this</span>.styleSheet.insertRule(sSelector + <span class="literal">" { "</span> + sStyle + <span class="literal">"} "</span>, iIndex);
	}
}

<span class="comment">/**
 * Deletes an existing style rule for the styleSheet object,
 * and adjusts the index of the rules collection accordingly. 
 * <span class="attrib">@param</span> &lt;int&gt; iIndex Integer that specifies the index value of the rule to be deleted from the style sheet.
 *				If an index is not provided, the first rule in the rules collection is removed.
 */</span>
StyleSheet.<span class="reserved">prototype</span>.removeRule = <span class="reserved">function</span>(iIndex)
{
	<span class="reserved">if</span> (js.lang.System.isIeBrowser())
	{
		<span class="reserved">this</span>.styleSheet.removeRule(iIndex);
	}
	<span class="reserved">if</span> (js.lang.System.isMozBrowser())
	{
		<span class="reserved">this</span>.styleSheet.deleteRule(iIndex);
	}
}

<span class="comment">/**
 * Creates a new StyleSheet object
 * <span class="attrib">@param</span> &lt;Document&gt; doc Document that specifies the document object of the StyleSheet to be created on the document.
 *				default is current document.
 * <span class="attrib">@returns</span> a new StyleSheet object
 * <span class="attrib">@type</span> StyleSheet
 */</span>
StyleSheet.create = <span class="reserved">function</span> (doc)
{
	doc = doc || document;
	var element = doc.createElement(<span class="literal">"style"</span>);
	doc.getElementsByTagName(<span class="literal">"HEAD"</span>)[0].appendChild(element);
	var len = doc.styleSheets.length;
	<span class="reserved">return</span> new StyleSheet(doc.styleSheets.item(len - 1));
}

<span class="comment">/**
 * Creates a new StyleSheet object and adds css link file for it.
 * <span class="attrib">@param</span> &lt;String&gt; url the url of the css file
 * <span class="attrib">@param</span> &lt;Document&gt; doc The document that the style sheet apply it.
 * <span class="attrib">@returns</span> a new StyleSheet object
 * <span class="attrib">@type</span> StyleSheet
 */</span>
StyleSheet.addCssLink = <span class="reserved">function</span> (url, doc)
{
	doc = doc || document;
	<span class="reserved">if</span> (System.isIeBrowser())
	{
		<span class="reserved">return</span> doc.createStyleSheet(url);
	}
	<span class="reserved">else</span>
	{
		var elmt = doc.createElement(<span class="literal">"link"</span>);
		doc.getElementsByTagName(<span class="literal">"HEAD"</span>)[0].appendChild(elmt);
		elmt.setAttribute(<span class="literal">"rel"</span>, <span class="literal">"stylesheet"</span>);
		elmt.setAttribute(<span class="literal">"href"</span>, url);
		<span class="reserved">return</span> elmt;
	}
}</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="../index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="../overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="../allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Thu Nov 17 20:10:21 2005</div>
</body>
</html>
